const app = getApp(),
      WxParse = require('../../component/wxParse/wxParse.js'),
      util=require('../../utils/util.js');
Page({
  data:{
    w_h:null,
    jobList:[],
    alerts:false,
    twoalert:false,
    twoalertText:'',
    three:true
  },
  onLoad:function(options){
    let hg=null;
    console.log(options.id,'职位编号')
    wx.getSystemInfo({
      success (res) {
        hg=res.windowHeight;
      }
    });
    this.setData({
      w_h:hg
    });
  },
  onShow(){
    this.getJobDetail()
  },
  getJobDetail(){
    let that=this;
    util.post('standard/achievementDetail',{id:that.options.id},function(res){
      console.log(res,'职位详情')
      if(res.statusCode==200 && res.data.code==1){
        WxParse.wxParse('article', 'html', res.data.data.job_detail, that, 0)
        that.setData({
          'jobList[0]':res.data.data
        })
        console.log(that.data.jobList,'职位详情')
      }
    })
  },
  handleAlert:function(){
    this.setData({
      alerts:true
    })
  },
  handleNone:function(){
    this.setData({
      alerts:false
    })
  },
  reqTip(msg){
    this.setData({
      three:false,
      twoalertText:msg,
      twoalert:true
    })
    setTimeout(()=>{
      this.setData({
        alerts:false
      })
    },2000);
    setTimeout(()=>{
      this.setData({
        three:true,
        twoalert:false
      })
    },2000)
  },
  handleSubmit:function(){
    let that=this;
    util.post('standard/signupWork',{id:that.options.id},function(res){
      that.reqTip(res.data.msg)
    },null,function(res){
      that.reqTip(res.data.msg || '提交失败')
    })
  }
})